home *** CD-ROM | disk | FTP | other *** search
/ Programming an RTS Game with Direct3D / Programming an RTS Game with Direct3D.iso / Examples / Chapter 7 / Example 7.1 / debug.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2005-12-04  |  677 b   |  25 lines

  1. #include "debug.h"
  2.  
  3. std::ofstream out("debug.txt");
  4.  
  5. DEBUG::DEBUG()
  6. {
  7.     
  8. }
  9.  
  10. DEBUG::~DEBUG()
  11. {
  12.     if(out.good())
  13.         out.close();
  14. }
  15.  
  16. void DEBUG::Print(char c[])
  17. {
  18.     out << c << std::endl;
  19. }
  20. std::ofstream& DEBUG::operator<<(char c[]){out << c; return out;}
  21. std::ofstream& DEBUG::operator<<(int i){out << i; return out;}
  22. std::ofstream& DEBUG::operator<<(float f){out << f; return out;}
  23. std::ofstream& DEBUG::operator<<(bool b){if(b)out << "True"; else out << "False"; return out;}
  24. std::ofstream& DEBUG::operator<<(D3DXVECTOR3 v){out << "x: " << v.x << ", y: " << v.y << ", z: " << v.z;return out;}
  25. void DEBUG::Endl(int nr){for(int i=0;i<nr;i++)out << std::endl;}